package com.ricky.onlineShop.serviceBus.trading;

import com.ricky.common.utils.DateUtils;
import com.ricky.onlineShop.read.trading.service.TradingPerformanceReadService;
import com.ricky.onlineShop.shop.trading.pojo.TradingPerformance;
import com.ricky.onlineShop.shop.trading.service.ITradingPerformanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @Author staticlan
 * @Date 2024/7/17 16:38
 * @Description:
 */
@Service
@Transactional
public class TradingPerformanceServiceBus {
    @Autowired
    private ITradingPerformanceService tradingPerformanceService;

    @Autowired
    private TradingPerformanceReadService tradingPerformanceReadService;

    public Map<String, Object> myPerformance() {
        return tradingPerformanceService.myPerformance();
    }

    public TradingPerformance selectTradingPerformanceById(String id) {
        return tradingPerformanceReadService.selectTradingPerformanceById(id);
    }

    /**
     * 查询绩效列表
     *
     * @param tradingPerformance 绩效
     * @return 绩效
     */
    public List<TradingPerformance> selectTradingPerformanceList(TradingPerformance tradingPerformance)
    {
        return tradingPerformanceReadService.selectTradingPerformanceList(tradingPerformance);
    }

    /**
     * 新增绩效
     *
     * @param tradingPerformance 绩效
     * @return 结果
     */
    public int insertTradingPerformance(TradingPerformance tradingPerformance)
    {
        tradingPerformance.setCreateTime(DateUtils.getNowDate());
        return tradingPerformanceReadService.insertTradingPerformance(tradingPerformance);
    }

    /**
     * 修改绩效
     *
     * @param tradingPerformance 绩效
     * @return 结果
     */
    public int updateTradingPerformance(TradingPerformance tradingPerformance)
    {
        tradingPerformance.setUpdateTime(DateUtils.getNowDate());
        return tradingPerformanceReadService.updateTradingPerformance(tradingPerformance);
    }

    /**
     * 批量删除绩效
     *
     * @param ids 需要删除的绩效主键
     * @return 结果
     */
    public int deleteTradingPerformanceByIds(String[] ids)
    {
        return tradingPerformanceReadService.deleteTradingPerformanceByIds(ids);
    }

    /**
     * 删除绩效信息
     *
     * @param id 绩效主键
     * @return 结果
     */
    public int deleteTradingPerformanceById(String id)
    {
        return tradingPerformanceReadService.deleteTradingPerformanceById(id);
    }
}
